<?
class ss_dao_daf
{
	static $instance;
	static private $source;
	
	private function __construct(){
		
	}

	public function setSource($source){
		ss_dao_daf::$source=$source;
	}

	public function getSource(){
		return ss_dao_daf::$source;
	}

	public function append($name,$source){
		ss_dao_daf::$source[$name]=$source;
	}
	
	public static function instance(){
		return ss_dao_daf::$instance;
	}

	public function getDA($name='default'){
		if(!isset($this->da[$name])){
			if(is_array($this->source[$name])){
				$class='ss_dao_DataAccess';
				if($this->source[$name]['type']) $class='ss_dao_'.$this->source[$name]['type'].'DataAccess';
				$this->da[$name]=new $class($this->source[$name]);
			} else {
				throw new Exception('Unable to create Data Access: Source data missing');
			}
		}
		return $this->da[$name];
	}
}

?>